<?php
    $data = json_decode(file_get_contents("data.txt"));
    $ip = $_SERVER["REMOTE_ADDR"];
    
    $cur_team = NULL;
    foreach ($data as $team) {
        if ($team->{"ip"} == $ip || 1) {
            $cur_team = $team;
            break;
        }
    }
    
    if ($cur_team == NULL) {
        print("Team not found. IP: ".$ip);
        exit(0);
    }
?>


<html>
    <head>
         <meta http-equiv="content-type" content="text/html; charset=utf-8">
         <link rel="stylesheet" href="main.css" content="text/css" charset="utf-8" />
    </head>
    <body>
        <img src="main.jpg" class="bg"></img>
        <img src="msu_logo.jpg" class="msu-logo"></img>
        <img src="cmc_logo.gif" class="cmc-logo"></img>
        <div class="main-title">
            Московская командная олимпиада<br>по программированию
        </div>
        
        <div class="user-info"><div style="display:inline-block; zoom: 1; *display: inline;">
            <div class="team info-item">
                <div class="title">Команда</div>
                <div class="value">&ldquo;<?php echo $cur_team->{'team_name'}; ?>&rdquo;</div>
            </div>
            <div class="info-item">
                <div class="value">
                    <?php
                        foreach ($cur_team->{"participants"} as $parc) {
                            ?>
                                <div class="user">
                                    <div class="name">
                                        <?php
                                            echo $parc->{"name"};
                                        ?>
                                    </div>,
                                    <div class="cl">
                                        <?php
                                            echo $parc->{"class"};
                                        ?>
                                        класс
                                    </div>
                                </div>

                            <?php
                        }
                    ?>
                                        
                </div>
            </div>
            <div class="city info-item">
                <div class="value"><?php echo $cur_team->{"city"};?></div>
            </div>


            <div class="info-item" style="padding-top: 40px;">
                <div class="value"><a href="http://acm.msu.ru/moscow-team">acm.msu.ru/moscow-team</a></div>
            </div>
            <div class="info-item">
                <div class="value"><a href="http://">Справочные материалы</a></div>
            </div>
        </div></div>
        
        <div class="computer">
            <?php echo $cur_team->{"computer"};?>
        </div>

    </body>
</html>

